<template>
<div>
  <el-table
      ref="multipleTable"
      :data="userlist"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
    <el-table-column
        type="selection"
        width="55">
    </el-table-column>
    <el-table-column
        prop="name"
        label="姓名"
        width="120">
    </el-table-column>
    <el-table-column
        prop="nickname"
        label="昵称"
        width="120">
    </el-table-column>
    <el-table-column
        prop="sex"
        label="性别"
        width="120">
    </el-table-column>
    <el-table-column
        prop="birthday"
        label="生日"
        width="120">
    </el-table-column>
    <el-table-column
        prop="city"
        label="地址"
        width="120">
    </el-table-column>
    <el-table-column
        prop="introduction"
        label="自我介绍"
        show-overflow-tooltip>
    </el-table-column>
  </el-table>
  <div style="margin-top: 20px">
    <el-button @click="toggleSelection()">取消选择</el-button>
  </div>
</div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      form: {
        delivery: false,
        type: [],
        resource: '',
        desc: '',
      },
      userlist:[],
      list: []
    }
  },
  created() {
    this.getMyInfo();

  },

  methods: {

    getMyInfo() {
      this.$axios.get('/api/user/mine/info').then(res => {
        console.log(res.data.data)
        this.userlist = res.data[0];
        localStorage.setItem('USER_NAME', res.data.data.name);
        localStorage.setItem('USER_CITY', res.data.data.city);
        localStorage.setItem('USER_NICKNAME', res.data.data.nickname);
        localStorage.setItem('USER_SEX', res.data.data.sex);
        localStorage.setItem('USER_BIRTHDAY', res.data.data.birthday);
        localStorage.setItem('USER_INTRODUCTION', res.data.data.introduction);
      })
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  }
}
</script>

<style scoped>

</style>